/*
* Copyright 2006-2007 Javector Software LLC
*
* Licensed under the GNU General Public License, Version 2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*      http://www.gnu.org/copyleft/gpl.html
*
* THE SOURCE CODE AND ACCOMPANYING FILES ARE PROVIDED WITHOUT ANY WARRANTY,
* WRITTEN OR IMPLIED.
*
* The copyright holder provides this software under other licenses for those
* wishing to include it with products or systems not licensed under the GPL.
* Contact licenses@javector.com for more information.
*/
package com.javector.soaj.provider.processing;

/**
 * SOAJ Request Processing class.  Abstract class that implements the Template
 * Method Pattern.  Concrete subclasses implement request processing for SOAP
 * requests and WSDL requests.
 */
public abstract class RequestOperation {
  
  protected WSRequest wsRequest;
  
  protected RequestOperation(WSRequest wsRequest) {
    this.wsRequest = wsRequest;
  }
  
  protected abstract void doPreOperation();
  
  public final WSResponse perform() {
    doDefault();
    doPreOperation();
    doOperation();
    doPostOperation();
    return getOutputParam();
  }
  
  /**
   * The first step in processing a SOAJ request.
   */
  private void doDefault() { }
  
  protected abstract void doOperation();
  
  protected abstract void doPostOperation();
  
  protected abstract WSResponse getOutputParam();
  
}
